#coding=utf-8
import logging
import os

# 数据库信息
CCMSDB = dict(host='192.168.3.10',user='root',passwd='max123',db='kcv',charset='utf8',port=3306)

# 程序版本信息
__VERSION__ = 'CCMS V2.0.0'

# 程序端口
PORT = 8687

# 数据库表前缀
DBPREFIX = 'cc'

# 群呼品牌ID
#BRAND = 'ccms'
BRAND = '3g'

# 短信账户信息
# SMSNAME ='qunhuhz'
# SMSPWD = 'qunhuhz123'
SMSNAME ='tongyi'
SMSPWD = 'tongyi_pt'

# 查询短信余额URL
SMS_URL = 'http://sms.guoling.com:8000/sms'

# 群发短信URL
SINGLE_SMS_URL = 'http://sms.guoling.com:8000/sms/sms_http.php' #单条
BATCH_SMS_URL = 'http://sms.guoling.com:8000/sms/sms_mass.php' #批量

# cb_gwURL
#CBGW_ADDR = 'http://117.121.55.202:8888'
CBGW_ADDR = 'http://172.16.1.141:8888'

# 接收数据URL
#FROM_URL = 'http://127.0.0.1:8687/comeback'
FROM_URL = 'http://172.16.12.15:8687/comeback'

# 查询间隔时间
TIME_QUEST = 1000*60*5

# 设置超时几次停止定时器
TIMEOUT_NUM = 5

# 系统默认值
CALL_RATE = 0.05 # 群呼费率
SMS_RATE = 0.1   # 短信费率
UNIT = 6         # 计费模式 6秒单元
CRENT = 300      # 并发量 

#配置用户的余额限制 单位元
USER_BALANCE = 5


# 邮件通知配置
to_email = ['897099895@qq.com']
mail_host = u"smtp.vip.163.com"       
user_name = u"ismond@vip.163.com"   
password = "ismond163vip"


#redis配置
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
REDIS_DB = 0
REDIS_PWD = ''

#存储到redis数据名称的前缀定义(名称加上任务的id)
CFG_HASH_NAME = 'task_cfg' #任务参数
PRE_EXEC_LIST_NAME = 'task_exec_'
PRE_CALL_HASH_NAME = 'task_call_'
FINISH_HASH_NAME = 'task_finish_'


#cbgw的每秒接收的值
SEND_CBGW_PER = 300
PROCESS__PER = 300
# IP认证通过后可访问comeback接口

# 运行日志位置
__LOG_FILE='./log/run.log'
logger = logging.getLogger()

def initLog():
    __DIR__ = "./log"
    if os.path.isdir(__DIR__) == False:
        os.makedirs(__DIR__) 
    hdlr = logging.handlers.TimedRotatingFileHandler(__LOG_FILE, when='midnight', backupCount=30)
    formatter = logging.Formatter("[%(asctime)s]: %(module)s %(message)s ")
    hdlr.setFormatter(formatter)
    logger.addHandler(hdlr)
    logger.setLevel(logging.DEBUG)
    logger.info("initialization log handler success! FILE=[%s]"%__LOG_FILE)

config_data = {
        'shape' : {'round':1, 'princess':2, 'heart':4, 'cushion':8, 'oval':16, 'pear':32, 'radiant':64, 'emerald':128, 'triangle':256, 'marquise':512, 'asscher':1024},
        'color' : {'C':1, 'D':2, 'E':4, 'F':8, 'G':16, 'H':32, 'I':64, 'J':128, 'K':256, 'L':512, 'M':1024, 'N':2048, 'O':4096, 'P':8192, 'Q':16384, 'R':32768, 'S':65536, 'T':131072, 'U':262144, 'V':524288, 'W':1048576, 'X':2097152, 'Y':4194304, 'Z':8388608},
         # 'colorful'  =>      array( 1 => 'yellow', 2 => 'pink', 4 => 'brown', 8 => 'blue', 16 => 'red', 32 => 'green', 64 => 'purple', 128 => 'orange', 256 => 'champagne', 512 => 'gray', 1024 => 'black', 2048 => 'violet', 4096 => 'chameleon'),
        'clarity' : {'FL':1, 'IF':2, 'VVS1':4, 'VVS2':8, 'VS1':16, 'VS2':32, 'SI1':64, 'SI2':128, 'SI3':256, 'I1':512, 'I2':1024, 'I3':2048},
        'cut' : {'ID':1, 'EX':2, 'VG':4, 'GD':8, 'FR':16, 'PR':32, 'NN':1024},
        'polish' : {'ID':1, 'EX':2, 'VG':4, 'GD':8, 'FR':16, 'PR':32, 'NN':1024},
        'symmetry' : {'ID':1, 'EX':2, 'VG':4, 'GD':8, 'FR':16, 'PR':32, 'NN':1024},
        'color_intensity': {'F':1, 'VL':2, 'L':4, 'FL':8, 'FC':16, 'FCD':32, 'I':64, 'D':128, 'FV':256}, #彩钻强度
        'color_overtone':  { 'none':1,  'brownish':2, 'greenish':4, 'yellowish':8, 'pinkish':16, 'purplish':32,'grayish':64, 'orangey':128, 'reddish':256, 'bluish':512},
        'color_color' :    { 'yellow':1, 'pink':2, 'blue':4, 'red':8, 'green':16, 'purple':32, 'orange':64, 'violet':128, 'gray':256, 'black':512, 'brown':1024, 'champagne':2048, 'cognac':4096, 'chameleon':8192, 'white':16384, 'other':8388608},
        'report':         { 'GIA':1,'NGTC':2, 'IGI':4, 'HRD':8, 'None':16, 'AGS':32, 'VGR':64, 'EGL':128, 'Other':65536},
        'polish':        {'ID':1, 'EX':2, 'VG':4, 'GD':8, 'FR':16, 'PR':32}, # 抛光
        'fluorescence':   { 'N':1,  'VSL':2,'F':4, 'M':8,  'S':16, 'VS':32}, #荧光
        'colsh':          { 'WH':1, 'BR1':2, 'BR2':4, 'BR3':8,'BRX':16}, # 咖色
        'milky':           { 'M0':1, 'M1':2, 'M2':4, 'M3':8, 'MX':16}, # 奶色
        'table_inc':       { 'T0':1, 'T1':2, 'T2':4, 'T3':8}, # 台面 有无瑕疵
        'black_inc':       { 'B0':1, 'B1':2, 'B2':4, 'B3':8},# 黑点
        'eyeclean':        { 'E0':1, 'E1':2, 'E2':4, 'NO':8}, # 肉眼可见度
        'ha':             { 'NHA':1, 'VG':2, 'H&A':4,'EX':8, 'ID':16}, # 八心八箭
}
    
    
if __name__=='__main__':
    print("main")
